﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace EnglishStudy.Entity
{
    [DataContractAttribute]
    public class FacebookUser
    {
        public FacebookUser() { }

        #region ID Property (string)
        private string _id;
        [DataMember(Name = "id")]
        public string ID
        {
            get { return _id; }
            set { _id = value; }
        }
        #endregion

        #region FirstName Property (string)
        private string _name;
        [DataMember(Name = "name")]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        #endregion

        #region FirstName Property (string)
        private string _firstName;
        [DataMember(Name = "first_name")]
        public string FirstName
        {
            get { return _firstName; }
            set { _firstName = value; }
        }
        #endregion

        #region LastName Property (string)
        private string _lastName;
        [DataMember(Name = "last_name")]
        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }
        #endregion

        #region Link Property (string)
        private string _link;
        [DataMember(Name = "link")]
        public string Link
        {
            get { return _link; }
            set { _link = value; }
        }
        #endregion

        #region UserName Property (string)
        private string _userName;
        [DataMember(Name = "username")]
        public string UserName
        {
            get { return _userName; }
            set { _userName = value; }
        }
        #endregion

        #region Birthday Property (string)
        private string _birthday;
        [DataMember(Name = "birthday")]
        public string Birthday
        {
            get { return _birthday; }
            set { _birthday = value; }
        }
        #endregion

        #region Location Property (string)
        private GenericFacebookField _location;
        [DataMember(Name = "location")]
        public GenericFacebookField Location
        {
            get { return _location; }
            set { _location = value; }

        }
        #endregion

        #region Gender Property (string)
        private string _gender;
        [DataMember(Name = "gender")]
        public string Gender
        {
            get { return _gender; }
            set { _gender = value; }
        }
        #endregion

        #region RelationshipStatus Property (string)
        private string _relationshipStatus;
        [DataMember(Name = "relationship_status")]
        public string RelationshipStatus
        {
            get { return _relationshipStatus; }
            set { _relationshipStatus = value; }
        }
        #endregion

        #region Email Property (string)
        private string _email;
        [DataMember(Name = "email")]
        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }
        #endregion

        #region Avatar Property (string)
        private string _avatar;
        public string Avatar
        {
            get { return "https://graph.facebook.com/" + _id + "/picture"; }
            set { _avatar = value; }
        }
        #endregion

        public override string ToString()
        {
            string returnValue = "";
            returnValue += "ID: " + this.ID + "\n";
            returnValue += "Name: " + this.Name + "\n";
            returnValue += "First Name: " + this.FirstName + "\n";
            returnValue += "Last Name: " + this.LastName + "\n";
            returnValue += "Link: " + this.Link + "\n";
            returnValue += "UserName: " + this.UserName + "\n";
            returnValue += "Birthday: " + this.Birthday + "\n";
            returnValue += "Location: " + this.Location + "\n";
            returnValue += "Gender: " + this.Gender + "\n";
            returnValue += "Relationship Status: " + this.RelationshipStatus + "\n";
            returnValue += "Email: " + this.Email + "\n";
            return returnValue;
        }
    }

    [DataContractAttribute]
    public class GenericFacebookField
    {
        public GenericFacebookField() { }

        #region ID Property (string)
        private string _id;
        [DataMember(Name = "id")]
        public string ID
        {
            get { return _id; }
            set { _id = value; }
        }
        #endregion

        #region Name Property (string)
        private string _name;
        [DataMember(Name = "name")]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        #endregion

        public override string ToString()
        {
            return _name;
        }
    }
}
